//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CI18N {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CI18N(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CI18N obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CI18N(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static void setLoadProxy(SWIGTYPE_p_NLMISC__CI18N__ILoadProxy loadProxy) {
    nelmiscJNI.CI18N_setLoadProxy(SWIGTYPE_p_NLMISC__CI18N__ILoadProxy.getCPtr(loadProxy));
  }

  public static SWIGTYPE_p_NLMISC__CI18N__ILoadProxy getLoadProxy() {
    long cPtr = nelmiscJNI.CI18N_getLoadProxy();
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CI18N__ILoadProxy(cPtr, false);
  }

  public static SWIGTYPE_p_std__vectorT_ucstring_t getLanguageNames() {
    return new SWIGTYPE_p_std__vectorT_ucstring_t(nelmiscJNI.CI18N_getLanguageNames(), false);
  }

  public static Vector_String getLanguageCodes() {
    return new Vector_String(nelmiscJNI.CI18N_getLanguageCodes(), false);
  }

  public static void load(String languageCode, String fallbackLanguageCode) {
    nelmiscJNI.CI18N_load__SWIG_0(languageCode, fallbackLanguageCode);
  }

  public static void load(String languageCode) {
    nelmiscJNI.CI18N_load__SWIG_1(languageCode);
  }

  public static void loadFromFilename(String filename, boolean reload) {
    nelmiscJNI.CI18N_loadFromFilename(filename, reload);
  }

  public static ucstring getCurrentLanguageName() {
    return new ucstring(nelmiscJNI.CI18N_getCurrentLanguageName(), true);
  }

  public static String getCurrentLanguageCode() {
    return nelmiscJNI.CI18N_getCurrentLanguageCode();
  }

  public static ucstring get(String label) {
    return new ucstring(nelmiscJNI.CI18N_get(label), false);
  }

  public static boolean hasTranslation(String label) {
    return nelmiscJNI.CI18N_hasTranslation(label);
  }

  public static void readTextFile(String filename, ucstring result, boolean forceUtf8, boolean fileLookup, boolean preprocess, CI18N.TLineFormat lineFmt, boolean warnIfIncludesNotFound) {
    nelmiscJNI.CI18N_readTextFile__SWIG_0(filename, ucstring.getCPtr(result), result, forceUtf8, fileLookup, preprocess, lineFmt.swigValue(), warnIfIncludesNotFound);
  }

  public static void readTextFile(String filename, ucstring result, boolean forceUtf8, boolean fileLookup, boolean preprocess, CI18N.TLineFormat lineFmt) {
    nelmiscJNI.CI18N_readTextFile__SWIG_1(filename, ucstring.getCPtr(result), result, forceUtf8, fileLookup, preprocess, lineFmt.swigValue());
  }

  public static void readTextFile(String filename, ucstring result, boolean forceUtf8, boolean fileLookup, boolean preprocess) {
    nelmiscJNI.CI18N_readTextFile__SWIG_2(filename, ucstring.getCPtr(result), result, forceUtf8, fileLookup, preprocess);
  }

  public static void readTextFile(String filename, ucstring result, boolean forceUtf8, boolean fileLookup) {
    nelmiscJNI.CI18N_readTextFile__SWIG_3(filename, ucstring.getCPtr(result), result, forceUtf8, fileLookup);
  }

  public static void readTextFile(String filename, ucstring result, boolean forceUtf8) {
    nelmiscJNI.CI18N_readTextFile__SWIG_4(filename, ucstring.getCPtr(result), result, forceUtf8);
  }

  public static void readTextFile(String filename, ucstring result) {
    nelmiscJNI.CI18N_readTextFile__SWIG_5(filename, ucstring.getCPtr(result), result);
  }

  public static void readTextBuffer(SWIGTYPE_p_unsigned_char buffer, long size, ucstring result, boolean forceUtf8) {
    nelmiscJNI.CI18N_readTextBuffer__SWIG_0(SWIGTYPE_p_unsigned_char.getCPtr(buffer), size, ucstring.getCPtr(result), result, forceUtf8);
  }

  public static void readTextBuffer(SWIGTYPE_p_unsigned_char buffer, long size, ucstring result) {
    nelmiscJNI.CI18N_readTextBuffer__SWIG_1(SWIGTYPE_p_unsigned_char.getCPtr(buffer), size, ucstring.getCPtr(result), result);
  }

  public static void removeCComment(ucstring commentedString) {
    nelmiscJNI.CI18N_removeCComment(ucstring.getCPtr(commentedString), commentedString);
  }

  public static String encodeUTF8(ucstring str) {
    return nelmiscJNI.CI18N_encodeUTF8(ucstring.getCPtr(str), str);
  }

  public static void writeTextFile(String filename, ucstring content, boolean utf8) {
    nelmiscJNI.CI18N_writeTextFile__SWIG_0(filename, ucstring.getCPtr(content), content, utf8);
  }

  public static void writeTextFile(String filename, ucstring content) {
    nelmiscJNI.CI18N_writeTextFile__SWIG_1(filename, ucstring.getCPtr(content), content);
  }

  public static ucstring makeMarkedString(SWIGTYPE_p_ucchar openMark, SWIGTYPE_p_ucchar closeMark, ucstring text) {
    return new ucstring(nelmiscJNI.CI18N_makeMarkedString(SWIGTYPE_p_ucchar.getCPtr(openMark), SWIGTYPE_p_ucchar.getCPtr(closeMark), ucstring.getCPtr(text), text), true);
  }

  public static void skipWhiteSpace(SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator last, ucstring storeComments, boolean newLineAsWhiteSpace) {
    nelmiscJNI.CI18N_skipWhiteSpace__SWIG_0(SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(last), ucstring.getCPtr(storeComments), storeComments, newLineAsWhiteSpace);
  }

  public static void skipWhiteSpace(SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator last, ucstring storeComments) {
    nelmiscJNI.CI18N_skipWhiteSpace__SWIG_1(SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(last), ucstring.getCPtr(storeComments), storeComments);
  }

  public static void skipWhiteSpace(SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator last) {
    nelmiscJNI.CI18N_skipWhiteSpace__SWIG_2(SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(last));
  }

  public static boolean parseLabel(SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator last, SWIGTYPE_p_std__string label) {
    return nelmiscJNI.CI18N_parseLabel(SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(last), SWIGTYPE_p_std__string.getCPtr(label));
  }

  public static boolean parseMarkedString(SWIGTYPE_p_ucchar openMark, SWIGTYPE_p_ucchar closeMark, SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator last, ucstring result, SWIGTYPE_p_unsigned_int lineCounter, boolean allowNewline) {
    return nelmiscJNI.CI18N_parseMarkedString__SWIG_0(SWIGTYPE_p_ucchar.getCPtr(openMark), SWIGTYPE_p_ucchar.getCPtr(closeMark), SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(last), ucstring.getCPtr(result), result, SWIGTYPE_p_unsigned_int.getCPtr(lineCounter), allowNewline);
  }

  public static boolean parseMarkedString(SWIGTYPE_p_ucchar openMark, SWIGTYPE_p_ucchar closeMark, SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator last, ucstring result, SWIGTYPE_p_unsigned_int lineCounter) {
    return nelmiscJNI.CI18N_parseMarkedString__SWIG_1(SWIGTYPE_p_ucchar.getCPtr(openMark), SWIGTYPE_p_ucchar.getCPtr(closeMark), SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(last), ucstring.getCPtr(result), result, SWIGTYPE_p_unsigned_int.getCPtr(lineCounter));
  }

  public static boolean parseMarkedString(SWIGTYPE_p_ucchar openMark, SWIGTYPE_p_ucchar closeMark, SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator last, ucstring result) {
    return nelmiscJNI.CI18N_parseMarkedString__SWIG_2(SWIGTYPE_p_ucchar.getCPtr(openMark), SWIGTYPE_p_ucchar.getCPtr(closeMark), SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(last), ucstring.getCPtr(result), result);
  }

  public static boolean matchToken(String token, SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator end) {
    return nelmiscJNI.CI18N_matchToken(token, SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(end));
  }

  public static void skipLine(SWIGTYPE_p_ucstring__const_iterator it, SWIGTYPE_p_ucstring__const_iterator end, SWIGTYPE_p_unsigned_int lineCounter) {
    nelmiscJNI.CI18N_skipLine(SWIGTYPE_p_ucstring__const_iterator.getCPtr(it), SWIGTYPE_p_ucstring__const_iterator.getCPtr(end), SWIGTYPE_p_unsigned_int.getCPtr(lineCounter));
  }

  public static java.math.BigInteger makeHash(ucstring str) {
    return nelmiscJNI.CI18N_makeHash(ucstring.getCPtr(str), str);
  }

  public static String hashToString(java.math.BigInteger hash) {
    return nelmiscJNI.CI18N_hashToString(hash);
  }

  public static java.math.BigInteger stringToHash(String str) {
    return nelmiscJNI.CI18N_stringToHash(str);
  }

  public static void hashToUCString(java.math.BigInteger hash, ucstring dst) {
    nelmiscJNI.CI18N_hashToUCString(hash, ucstring.getCPtr(dst), dst);
  }

  public CI18N() {
    this(nelmiscJNI.new_CI18N(), true);
  }

  public final static class TLineFormat {
    public final static TLineFormat LINE_FMT_NO_CARE = new TLineFormat("LINE_FMT_NO_CARE");
    public final static TLineFormat LINE_FMT_LF = new TLineFormat("LINE_FMT_LF");
    public final static TLineFormat LINE_FMT_CRLF = new TLineFormat("LINE_FMT_CRLF");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TLineFormat swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TLineFormat.class + " with value " + swigValue);
    }

    private TLineFormat(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TLineFormat(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TLineFormat(String swigName, TLineFormat swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TLineFormat[] swigValues = { LINE_FMT_NO_CARE, LINE_FMT_LF, LINE_FMT_CRLF };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
